package com.wust.smartcity.admin.server.core.api.feign.server;

import com.wust.smartcity.admin.server.core.dao.SysDistributedFileMapper;
import com.wust.smartcity.common.annotations.FeignApi;
import com.wust.smartcity.common.dto.WebResponseDto;
import com.wust.smartcity.common.entity.sys.distributedfile.SysDistributedFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@FeignApi
@RequestMapping("/api/feign/v1/DistributedFileFeignApi")
@RestController
public class DistributedFileFeignApi {
    @Autowired
    private SysDistributedFileMapper sysDistributedFileMapper;


    @RequestMapping(value = "/insert",method= RequestMethod.POST)
    public WebResponseDto insert(@RequestBody SysDistributedFile entity) {
        WebResponseDto responseDto = new WebResponseDto();
        sysDistributedFileMapper.insert(entity);
        responseDto.setObj(entity);
        return responseDto;
    }

    @RequestMapping(value = "/deleteByPrimaryKey",method= RequestMethod.POST)
    public WebResponseDto deleteByPrimaryKey(@RequestParam Long id) {
        WebResponseDto responseDto = new WebResponseDto();
        sysDistributedFileMapper.deleteByPrimaryKey(id);
        return responseDto;
    }


    @RequestMapping(value = "/selectOne",method= RequestMethod.POST)
    public WebResponseDto selectOne(@RequestBody SysDistributedFile search) {
        WebResponseDto responseDto = new WebResponseDto();
        SysDistributedFile one = sysDistributedFileMapper.selectOne(search);
        responseDto.setObj(one);
        return responseDto;
    }
}
